Skip to content

KAFKA-20391: Improve types returned by the Connect REST API#22001

Open
gomudayya wants to merge 1 commit intoapache:trunkfrom
gomudayya:KAFKA-20391
Open

KAFKA-20391: Improve types returned by the Connect REST API#22001
gomudayya wants to merge 1 commit intoapache:trunkfrom
gomudayya:KAFKA-20391

Conversation

@gomudayya
Copy link
Copy Markdown
Contributor

@gomudayya gomudayya commented Apr 8, 2026

  • Replace generic Response return types with specific types in
    LoggingResource and ConnectorsResource to improve OpenAPI spec
    generation
  • Update corresponding unit tests
  • Endpoints returning non-200 status codes (201, 202, 204) or using
    conditional status codes were left unchanged as they require Response
    for status code control.

@github-actions github-actions bot added triage PRs from the community connect small Small PRs labels Apr 8, 2026
@Path("/{connector}/topics")
@Operation(summary = "Get the list of topics actively used by the specified connector")
public Response getConnectorActiveTopics(final @PathParam("connector") String connector) {
public Map<String, ActiveTopicsInfo> getConnectorActiveTopics(final @PathParam("connector") String connector) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To align with other endpoints, it is better to create an entity instead of Map

Message msg = requestHandler.completeOrForwardRequest(cb, "/connectors/" + connector + "/offsets", "PATCH", headers, offsets,
return requestHandler.completeOrForwardRequest(cb, "/connectors/" + connector + "/offsets", "PATCH", headers, offsets,
new TypeReference<>() { }, new IdentityTranslator<>(), forward);
return Response.ok().entity(msg).build();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this return we are missing the status code now. Aren't these breaking changes and need a kip ?

@Operation(summary = "List the current loggers that have their levels explicitly set and their log levels")
public Response listLoggers() {
return Response.ok(herder.allLoggerLevels()).build();
public Map<String, LoggerLevel> listLoggers() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, could be better if an entity (similar to what we have in org/apache/kafka/connect/runtime/rest/entities) is returned instead of a Map

@GET
@Operation(summary = "List the current loggers that have their levels explicitly set and their log levels")
public Response listLoggers() {
return Response.ok(herder.allLoggerLevels()).build();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to loose the 'ok' status code ?

Copy link
Copy Markdown
Contributor

@muralibasani muralibasani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gomudayya I have a few comments but main concern is by changing the return type, we are missing status code and is it ok for this ticket without kip? However to align with other resources, looks ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

connect small Small PRs triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants